import request from '@/utils/request.js'

export const blogApi = {
	list(blogQuery) {
		return request.get('/blog/list', {params: blogQuery})
	},
	deleteById(id) {
		return request.delete( `/blog/deleteById/${id}`)   //反引号，直接写参数。否则需要字符串拼接
	},
	deleteAll(ids) {
		return request.delete( `/blog/deleteAll/${ids}`)
	},
	add(blog) {
		//blog以JSON形式传递到后台
		return request.post('/blog/add', blog)
	},
	selectById(id) {
		return request.get(`/blog/selectById/${id}`)
	},
	update(blog) {
		return request.put('/blog/update', blog)
	},
	updateStatus(id,status){
		return request.put(`/blog/updateStatus/${id}/${status}`)
	},
	exportExcel(){
		return request({
			url:'/blog/exportExcel',
			method:'get',
			responseType: 'blob'
		})
	}
}
